package de.baumann.browser.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import de.baumann.browser.R
import de.baumann.browser.api.net.vo.OdinWithdrawRecord

/**
 *@author:
 *@date:2019/7/10 11:35
 *@discription: 提现记录适配器
 */
class WithdrawalsRecordAdapter(layoutResId: Int) : BaseQuickAdapter<OdinWithdrawRecord, BaseViewHolder>(layoutResId) {

    override fun convert(helper: BaseViewHolder, item: OdinWithdrawRecord) {
        val status = helper.getView<TextView>(R.id.tvWDState)
        helper.setText(R.id.tvWDId, mContext.getString(R.string.order_num) + item.id)
        helper.setText(R.id.tvWDTime, item.createDate)
        helper.setText(R.id.tvWDAmount, item.profit)
        when (item.status) {
            1 -> {
                status.setTextColor(mContext.resources.getColor(R.color.text_light))
                status.text = mContext.getString(R.string.processing)
            }
            2, 3 -> {
                status.setTextColor(mContext.resources.getColor(R.color.green_29FFBB))
                status.text = mContext.getString(R.string.Successful_withdrawal)
            }
            0, 4 -> {
                status.setTextColor(mContext.resources.getColor(R.color.color_RED_FF4040))
                status.text = mContext.getString(R.string.failed_withdrawal)
            }
        }
    }
}
